import request from '@/utils/request'
import qs from 'qs'

/** *******************        purch-order          ********************/

export function fetchOrderList(query) {
  return request({
    url: '/purch/order/list',
    method: 'get',
    params: query
  })
}

export function fetchOrder(id) {
  return request({
    url: `/purch/order/info/${id}`,
    method: 'get'
  })
}

export function createOrder(data) {
  return request({
    url: '/purch/order/info',
    method: 'post',
    data
  })
}

export function updateOrder(id, data) {
  return request({
    url: `/purch/order/info/${id}`,
    method: 'put',
    data
  })
}

export function deleteOrder(id) {
  return request({
    url: `/purch/order/info/${id}`,
    method: 'delete'
  })
}

/** *******************        purch-order-form          ********************/

export function completion(id,data){
  return request({
    url: `/purch/order/completion/${id}`,
    method: 'put',
    data
  })
}
export function addSchedule(id) {
  return request({
    url: `/purch/order/schedule/${id}`,
    method: 'put'
  })
}

export function addCart(id) {
  return request({
    url: `/purch/order/cart/${id}`,
    method: 'put'
  })
}

export function getShopcartStepTwo(id) {
  return request({
    url: `/purch/order/getShopcartStepTwo/${id}`,
    method: 'get'
  })
}

export function getDelivery(id) {
  return request({
    url: `/purch/order/getDelivery/${id}`,
    method: 'get'
  })
}

export function getOrderDetail(id) {
  return request({
    url: `/purch/order/getOrderDetail/${id}`,
    method: 'get'
  })
}